package com.rookie.tool.module.util.ai.util;

import java.util.HashMap;
import java.util.Map;

public class FaceUtils {

    public static String faceDetect() {
        // 请求url
        String url = "https://aip.baidubce.com/rest/2.0/face/v3/detect?access_token=";
        try {
            Map<String, Object> map = new HashMap<>(3);
            map.put("image", "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=953522358,6687051&fm=26&gp=0.jpg");
            map.put("face_field", "faceshape,facetype");
            map.put("image_type", "URL");

            String result = TokenUtils.restTemplate.postForObject(url + TokenUtils.getToken(),map , String.class);
            System.out.println(result);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void main(String[] args) {
        faceDetect();
    }
}
